﻿/*
 * Example Plugin for Reticle
 * MUST have the Reticle.Core.dll and BNSharp.dll Reference
 * Any questions about plugin development, visit www.bnetweb.org
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Reticle.Core;
using BNSharp.BattleNet;
using BNSharp;
using System.Windows.Forms;

namespace ScopesTestPlugin
{
    public class Main : IPlugin
    {
        public IHost Bot;
        public ToolStripMenuItem myMenu = new ToolStripMenuItem();

        #region IPlugin Members

        public string Author
        {
            get { return "Scope"; }
        }

        public string Name
        {
            get { return "Example Plugin"; }
        }

        public string Description
        {
            get { return "A simple plugin to show how the plugin system works"; }
        }

        // Do not use spaces in Filename
        public string Filename
        {
            get { return "ExamplePlugin.dll"; }
        }

        public string URL
        {
            get { return "http://www.bnetweb.org"; }
        }

        public void Initialize(IHost host)
        {
            Bot = host;

            // Create the plugin menu (and submenus)
            EventHandler e = new EventHandler(myMenus_Click);
            myMenu.Text = "Example Plugin";
            myMenu.DropDownItems.Add(PluginFunctions.NewToolMenu("Testing", "Testing", e));
            Bot.SetPluginMenu(myMenu);
        }

        // fires when the plugin is unloaded
        public void Unload()
        {
            Bot.UnloadPlugin();
        }

        // handles the click event of each menu item
        void myMenus_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem m = (ToolStripMenuItem)sender;
            switch (m.Name)
            {
                case "Testing":
                    MessageBox.Show("An Example Menu Item Event");
                    break;
            }
        }

        #region Battle.net Events
        // When the bot establishes a connection to Battle.net
        public void Connected(object sender, EventArgs e)
        {
            Bot.AddChat("green", "[Plugin] Connected!");
        }

        // When the bot is disconnected from Battle.net (for any reason)
        public void Disconnected(object sender, EventArgs e)
        {
            Bot.AddChat("red", "[Plugin] Disconnected!");
        }

        // When the bot receives an error from Battle.net (i.e. no friends)
        public void ServerErrorReceived(object sender, ServerChatEventArgs e)
        {
            
        }

        // When the bot receives information (i.e. friends list)
        public void InformationReceived(object sender, ServerChatEventArgs e)
        {
            
        }

        // When the bot enters chat
        public void EnteredChat(object sender, EnteredChatEventArgs e)
        {
            
        }

        // When the bot joins a channel (everytime it joins a channel)
        public void JoinedChannel(object sender, ServerChatEventArgs e)
        {
            
        }

        // When a user joins a channel
        public void UserJoined(object sender, UserEventArgs e)
        {
            
        }

        // When a user leaves the channel
        public void UserLeft(object sender, UserEventArgs e)
        {
            
        }

        // All users currently present in the channel (when the bot first joins)
        public void UserShown(object sender, UserEventArgs e)
        {
            
        }

        // When a person is op'd, de-op'd, etc
        public void UserFlagsChanged(object sender, UserEventArgs e)
        {
            
        }

        // When someone speaks
        public void UserSpoke(object sender, ChatMessageEventArgs e)
        {
            
        }

        // When someone emotes
        public void UserEmoted(object sender, ChatMessageEventArgs e)
        {
            
        }

        // When the bot talks
        public void MessageSent(object sender, ChatMessageEventArgs e)
        {
            
        }

        // When you receive a whisper
        public void WhisperReceived(object sender, ChatMessageEventArgs e)
        {
            
        }

        // When you send a whisper
        public void WhisperSent(object sender, ChatMessageEventArgs e)
        {
            
        }
        #endregion

        #endregion
    }
}
